import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-09-05
 * Time: 8:37
 * To BE A Better Person-2020-3-2
 */
public class TestDemo7 {
    public static void main(String[] args) {
        //try with resoucses
        //会自动调用close
        //必须实现closeable才行

        try(InputStream inputStream=new FileInputStream("test2.txt")){
            byte[] b=new byte[1024];
            inputStream.read(b);
            //.......
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
